/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cw.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author VinhTC
 */
@Entity
@Table(name = "tblLevel")
@NamedQueries({
    @NamedQuery(name = "Level.findAll", query = "SELECT l FROM Level l"),
    @NamedQuery(name = "Level.findByLevelId", query = "SELECT l FROM Level l WHERE l.levelId = :levelId"),
    @NamedQuery(name = "Level.findByLevelName", query = "SELECT l FROM Level l WHERE l.levelName = :levelName"),
    @NamedQuery(name = "Level.findByCountDown", query = "SELECT l FROM Level l WHERE l.countDown = :countDown"),
    @NamedQuery(name = "Level.findByStatus", query = "SELECT l FROM Level l WHERE l.status = :status")})
public class Level implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "LevelId")
    private Integer levelId;
    @Basic(optional = false)
    @Column(name = "LevelName")
    private String levelName;
    @Basic(optional = false)
    @Column(name = "CountDown")
    private int countDown;
    @Basic(optional = false)
    @Column(name = "Status")
    private boolean status;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "level")
    private List<Puzzle> puzzleList;

    public Level() {
    }

    public Level(Integer levelId) {
        this.levelId = levelId;
    }

    public Level(Integer levelId, String levelName, int countDown, boolean status) {
        this.levelId = levelId;
        this.levelName = levelName;
        this.countDown = countDown;
        this.status = status;
    }

    public Integer getLevelId() {
        return levelId;
    }

    public void setLevelId(Integer levelId) {
        this.levelId = levelId;
    }

    public String getLevelName() {
        return levelName;
    }

    public void setLevelName(String levelName) {
        this.levelName = levelName;
    }

    public int getCountDown() {
        return countDown;
    }

    public void setCountDown(int countDown) {
        this.countDown = countDown;
    }

    public boolean getStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }

    public List<Puzzle> getPuzzleList() {
        return puzzleList;
    }

    public void setPuzzleList(List<Puzzle> puzzleList) {
        this.puzzleList = puzzleList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (levelId != null ? levelId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Level)) {
            return false;
        }
        Level other = (Level) object;
        if ((this.levelId == null && other.levelId != null) || (this.levelId != null && !this.levelId.equals(other.levelId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cw.entity.Level[levelId=" + levelId + "]";
    }

}
